import org.junit.jupiter.api.Test;
import org.springframework.util.DigestUtils;

import java.text.DecimalFormat;
import java.util.Random;

/**
 * Create by xiaoye on 2023/3/22
 */

public class MD5 {
    public static void main(String[] args) {
        String password = "123456";
        //e10adc3949ba59abbe56e057f20f883e

        password = DigestUtils.md5DigestAsHex(password.getBytes());
        System.out.println(password);
    }

    @Test
    public void randomtest(){
        //Random random = new Random();
        float aFloat = new Random().nextFloat()* 0.9f + 0.1f;
        DecimalFormat decimalFormat = new DecimalFormat("#.#");
        String format = decimalFormat.format(aFloat);
        System.out.println(format);
    }
    @Test
    public void formatStress(){
        double stress = 21;
        int num = (int) Math.round(stress);
        if (num %2 == 1){
            num--;
        }
        System.out.println(Integer.toString(num));
    }
}
